<?php


namespace app\api\model;


use app\admin\model\express\Subscribe;
use think\Model;

class TemplateSub extends Model
{
    // 表名
    protected $name = 'express_template_sub';

    //微信小程序订阅模板列表
    const TEMPLATE_LIST =[
        "LcFQJ40BWHKWTU5tDd9UOxwRqHH0ddtYau706ex3pl4",  //下单成功通知
      //  "oqt7joCxGd6zcjsKnmCCe14-wM-BFS4PEz7f4jJ3K5A",  //包裹入库通知
        "0UWUA1hi4VYwHCp4Zin5tW1qeatMUFZt8UxYTSeoER8",  //运费补交提醒
        "hUyjob1nTCyd_ZtsO1xomZ24EYHYpV0FT44W7zIFOTM",  //物流信息提醒
    ];


    //下单成功通知
    public static function sendTemplate($user_id,$character_string,$thing,$page=""){
        $subscribe = new Subscribe();
        $template_id = 'LcFQJ40BWHKWTU5tDd9UOxwRqHH0ddtYau706ex3pl4';  //下单成功通知
        $data   = [
            'character_string2' => [
                'value' =>$character_string
            ],
            'phrase4' => [
                'value' => $thing
            ]
        ];
        return $subscribe->push($user_id, $template_id, $page, $data);
    }

    //包裹入库通知
    public static function sendTemplate1($user_id,$character_string,$thing,$page=""){
        $subscribe = new Subscribe();
        $template_id = 'oqt7joCxGd6zcjsKnmCCe14-wM-BFS4PEz7f4jJ3K5A';   //包裹入库通知
        $data   = [
            'character_string4' => [
                'value' => $character_string
            ],
            'thing3' => [
                'value' => $thing
            ]
        ];
        return $subscribe->push($user_id, $template_id, $page, $data);
    }

    //运费补交提醒
    public static function sendTemplate2($user_id,$character_string,$thing,$page=""){
        $subscribe = new Subscribe();
        $template_id = '0UWUA1hi4VYwHCp4Zin5tW1qeatMUFZt8UxYTSeoER8';   //运费补交提醒
        $data   = [
            'character_string1' => [
                'value' => $character_string
            ],
            'thing2' => [
                'value' => $thing
            ]
        ];
        return $subscribe->push($user_id, $template_id, $page, $data);
    }

    //物流信息提醒----快递发送
    public static function sendTemplate3($user_id,$character_string1,$character_string9,$thing,$page=""){
        $subscribe = new Subscribe();
        $template_id = 'hUyjob1nTCyd_ZtsO1xomZ24EYHYpV0FT44W7zIFOTM';   //物流信息提醒
        $data   = [
            'character_string1' => [
                'value' => $character_string1           //快递单号
            ],
            'character_string9' => [
                'value' => $character_string9          //包裹单号
            ],
            'thing10' => [
                'value' => $thing          //状态
            ]
        ];
        return $subscribe->push($user_id, $template_id, $page, $data);
    }

}
